<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<meta name="author" content="hexinyang">	
	<title>修改密码</title>
	<script language="javascript" type="text/javascript" src="../script/print.js"></script>
	<script language="javascript" src="../script/common.js" type="text/javascript"></script>
	<script language="javascript" src="../script/card.js" type="text/javascript"></script>
	<!--动态js-->
	<script language="javascript" type="text/javascript">
			//页面加载方法
		var pageData = {oldPin : null}
		function load(){
			Eui.showNavigation();
			setPages(["readcardview","detview"]);
		}
		
		function updatePin(){
			try{
				var pin = CardMgnt.inputCardPin("请持卡人输入新的密码");
				if (!pin) {onCancel();return;}
				var repeat = CardMgnt.inputCardPin("请重复输入新的密码");
				if (!repeat) {onCancel();return;}
				if (pin != repeat) {showWarning("两次输入的密码不一致！");return;}
				evalCardReturn(cardCom.changePIN(hCard,pageData.oldPin,pin));  //写卡信息
			}catch(e){
				showError(e.description);
				return ;
			}
			onCancel();
			DWR.call("cardMgntService.editPassword",getAsn(),function(cardLog){
				showInformation("密码修改成功！");
				switchPage("detview");
				CardMgnt.showPrintView("detview","password_bill",cardLog.logId,"密码修改凭证");
			});
			
		}
		
		function onReadCard(){
			try{
				var data = CardMgnt.findCardNeedPin(readCardForm);
				if (!getNeedPin()) {showWarning("卡片没有启用卡密码！");return;}
				if (!CardMgnt.checkInUseCard(data.card)) return;
				
				pageData.oldPin = data.cardPin;
				$("updatepswdbtn").disabled = false;
			}catch(e){
				showError(e.description);
			}
		}
		
		function onCancel(){
			readCardForm.reset();
			pageData = {}
			$("updatepswdbtn").disabled = true;
			switchPage('readcardview')
		}
		
	</script>
</head>
<body onload="load()">
	<!--页面导航-->
	<div class="nav"><div id="nav">&nbsp;</div></div>
	
	<div id="readcardview">
		<div id="carddiv">
<form name="readCardForm" id="readCardForm">
	<div class="form">
		<div class="formTitle">卡片信息</div>
		<table cellSpacing="0" cellPadding="4" width="100%" border="0" class="label6">
			<tr>
				<td><label>卡&nbsp;&nbsp;&nbsp;&nbsp;号</label> <input type="text" name="asn" readonly class="readonly"></td>
				<td><label>有 效 期</label> <input type="text" name="expiredTime" readonly class="readonly"></td>
			</tr>
			<tr>
				<td><label>卡 类 型</label> <input type="text" name="baseCardTypeText" readonly class="readonly"></td>
				<td><label>卡子类型</label> <input type="text" name="subCardTypeText" readonly class="readonly"></td>
			</tr>	
			<tr>
				<td><label>卡片状态</label> <input type="text" name="statusText" readonly class="readonly"></td>
				<td><label>黑名单类型</label> <input type="text" name="blackTypeText" readonly class="readonly"></td>
			</tr>
		</table>
	</div>
</form>
		</div>
		<p>
			<button id="readCardBtn" onclick="onReadCard()">读 卡</button>
			<button id="updatepswdbtn" onclick="updatePin()" disabled>修改密码</button>
			<button onclick="onCancel()">重 置</button>
		</p>
	</div>
	<div id="detview" style="display:none;">
	</div>
</body>
</html>
